<template>
    <div>
        <a-form :form="form" >
        <a-row :gutter="48">
            <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}" >
            <a-form-item label="院系">
              <a-select v-decorator="[
                    'yx',
                    {
                        rules: [{ required: true, message: '请选择院系!' }],
                    }
                    ]" :disabled="disabledStop">
                <a-select-option v-for="i in selectMenu.yx" :key="i.id" :value="i.dwh">{{ i.dwmc }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="专业">
              <a-select v-decorator="[
                    'zt',
                    {
                        rules: [{ required: true, message: '请选择专业!' }],
                    }
                    ]" :disabled="disabledStop">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col ::sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="招生人数">
              <a-input  v-decorator="[
                    'zsrs',
                    {
                        rules: [{ required: true, message: '请输入招生人数!' }],
                    }
                    ]" :disabled="disabledStop" />
            </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="招生年度">
              <a-select v-decorator="[
                    'zsnd',
                    {
                        rules: [{ required: true, message: '请选择招生年度!' }],
                    }
                    ]" :disabled="disabledStop">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
            <a-col :lg="24" :md="24" :sm="24">
                <a-form-item
                    label="复试科目"
                >
                    <a-textarea  v-decorator="[
                    'fskm',
                    {
                        rules: [{ required: true, message: '请输入复试科目!' }],
                    }
                    ]" :disabled="disabledStop" rows="4"/>
                </a-form-item>
            </a-col>
            <a-col :lg="24" :md="24" :sm="24">
                <a-form-item
                    label="加试科目"
                >
                    <a-textarea  v-decorator="[
                    'jskm',
                    {
                        rules: [{ required: true, message: '请输入何时何地何原因受过何种奖励或处分:(含研究生招生考试中的违纪处理结果)!' }],
                    }
                    ]" :disabled="disabledStop" rows="4"/>
                </a-form-item>
            </a-col>
            <a-col :lg="24" :md="24" :sm="24">
                <a-form-item
                    label="备注"
                >
                    <a-textarea  v-decorator="[
                    'bz',
                    {
                        rules: [{ required: true, message: '请输入备注!' }],
                    }
                    ]" :disabled="disabledStop" rows="4" />
                </a-form-item>
            </a-col>
        </a-row>
        </a-form>
    </div>
</template>

<script>
import { mapState } from 'vuex'

const selectArr = ['TYPE0126', 'TYPE0075', 'TYPE0125', 'TYPE0072']

export default {
  props: {
    confirmHandleVisiable: {
      default: false
    },
    info: {
      default: () => ({})
    },
    // 是否禁止编辑
    disabledStop: {
      default: true
    }
  },
  data () {
    return {
      loading: false,
      selectMenu: {
        yx: [] // 院系
      }
    }
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  computed: {
    ...mapState({
      systemInfo: state => state.app.systemInfo,
      TYPE0321: state => state.app['TYPE0321'], // 是否在岗
      TYPE0126: state => state.app['TYPE0126'], // 年级
      TYPE0011: state => state.app['TYPE0011'] // 性别
    })
  },
  created () {
    this.initSelectMenu()
    selectArr.forEach(v => {
      this.$store.dispatch('app/setDictionary', v)
    })
    for (let key in this.info) {
      this.form.getFieldDecorator(key, {initialValue: this.info[key]})
    }
  },
  methods: {
    initSelectMenu () {
      let allRequest = [
        this.$api.base.collegeAll()
      ]
      Promise.all(allRequest).then(res => {
        this.selectMenu = {
          yx: res[0].data
        }
      })
    },
    // 关闭
    onClose () {
      this.$emit('close')
    },
    // 验证数据并输出
    GetInfo () {
      return this.form.getFieldsValue()
    }
  }
}
</script>

<style lang="less">
.fullscreen{
    .ant-drawer-wrapper-body{
        height: 100%;
        overflow: auto;
    }
}
</style>
